what is the different ways to require FB like permissions? - java

Can someone explain what is the difference in getting permissions in one of the two:
1) via code, on first Fb login:
setContentView(R.layout.facebook_login);
LoginButton authButton = (LoginButton) findViewById(R.id.authButton);
// authButton.setReadPermissions(Arrays.asList("user_status"));
authButton.setReadPermissions(Arrays.asList("basic_info",
"user_birthday", "user_interests", "user_likes", "email",
"user_location", "publish_actions"));
2) via Facebook developer page:
if there is none, what is the duplication?
App Details --> Configure App Center Permissions

In (1), i.e. in code, you can choose at execution time which permissions to ask for. This means you can, for example, initially ask for just public_profile, and then later when the user wants to share something you can ask again for "publish_actions".
In (2), you are setting which permissions the user will grant if they start playing via the app centre (e.g. https://www.facebook.com/appcenter/yourgame). In this case the set of permissions you choose will be shown to the user in the app center before they start your game. When they press Play in the app centre they are granting the chosen permissions, so you don't need to call a login method from within your code.
These two sets of permissions can be different.

Related

How to pass User Privacy Consents and GDPR values to OneSignal SDK after the user provided the consents?

How can we help?
I am currently following your doc. and currently, I am working with Privacy Consents and GDPR stuff. here
Oka, I got all but one thing I am not getting here is supposed user has given my app permission or consent then how can I pass those consents to OneSignal SDK?
Like how can I tell OneSignal that the user is agreed or disagree?
Currently, I am doing stuff like this...
// On Application class OnCreate method
val hasGdprConsents = prefsManager.hasKey(PrefsManager.IS_GDPR_APPLIES)
val isGdprApplies = prefsManager.getPrefsBool(PrefsManager.IS_GDPR_APPLIES)
if(!OneSignal.userProvidedPrivacyConsent() && (isGdprApplies || !hasGdprConsents)) {
// Delays initialization of the SDK until the user provides privacy consent
OneSignal.setRequiresUserPrivacyConsent(true)
}
// OneSignal Initialization
OneSignal.initWithContext(this)
OneSignal.setAppId(getString(R.string.onesignal_app_id))
Now supposed at some point e.g Ads SDKS detects this region is under GDRP so my app asked for user consent and from there...
if the user agrees I set values like this.
onAgree => OneSignal.provideUserConsent(true)
onDisagree => OneSignal.provideUserConsent(false)
But I have a feeling like these methods are not intended for this purpose. They are just here to let OneSignal knows that oka we have taken the consent and you can do further initialization...etc
But what I want is to tell OneSignal that the user didn't allow to share or sell its data..etc
So how can I pass user consent to OneSignal SDK?

How to init asking admin's pattern in my code?

I'm developing app for Zebra device model MC33.
I like how internal apps ask to enter admin pattern (password) when I open Settings or others. In my app I have settings activity and I would like to ask user for authorization.
What I want to have is:
https://imgur.com/gallery/BwpAAPI
I used class DevicePolicyManager and then call for lock screen. (code is below)
But it turn off the sceen completely (it become black) like the device is switch off. Then I can enter pattern to turn it on.
This is screenshot what I get after using DevicePolicyManager:
https://imgur.com/gallery/TnHgDgs
DevicePolicyManager policy = (DevicePolicyManager)
getSystemService(Context.DEVICE_POLICY_SERVICE);
policy.lockNow();
Such behaviour may be misleading. Do you have idea how to call for proper screen in my app?

Display Twitter user profile without logging in?

I would like to display a twitter user profile without having the app prompt the phone user for creating an account or login information.
public void openTwitter(View view){
try
{
// Check if the Twitter app is installed on the phone.
getPackageManager().getPackageInfo("com.twitter.android", 0);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName("com.twitter.android", "com.twitter.android.ProfileActivity");
intent.putExtra("user_id", 01234567L);
startActivity(intent);
}
catch (PackageManager.NameNotFoundException e)
{
// If Twitter app is not installed, start browser.
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/xxx")));
}
}
The code opens the twitter app and prompts the phone user for account creation before viewing profile xxx. I would like to simply view profile xxx without creating an account or logging in.
Welcome to StackOverflow. Please check out how to ask a good question first. Your question doesn't describe a specific problem and therefore can't be "solved". It also isn't specific enough for anyone to point you in the direction of methods to use to achieve your goal.
That being said, if you just want to display anyone's profile, implement the Twitter API in your app and make the right REST calls and you should get the information you want to display.
If you want the user's profile specifically, there's literally no way around the user logging into their account with the API, unless they previously define their username in your app.
If you just want to display the profile and don't care about designing the information yourself, you could use a WebView to open the link to the profile you want to open, or use UIApplication.shared.open to open a link outside your own app.

Firebase Authentication returning specific user when app is uninstalled and Installed again

I have an issue where I am using google sign in for my application + Firebase.
Suppose there are 3 users X,Y and Z with whom I am login in my application at one instance of time.
My code for checking the user is logged in or not:
FirebaseAuth mAuth = FirebaseAuth.getInstance();
FirebaseUser currentUser = mAuth.getCurrentUser();
if(currentUser!=null)
{
//user logged in and get user detail from currentUser and go to HomePage
}
else{
//Show sign in button
}
Scenario :
I signed it with multiple accounts and logged out. everything working fine.
But when I delete the application and again install it. The Y user is automatically return by mAuth.getCurrentUser().
I tried login with X and Uninstall the application.
Still, if I install it again it directly takes me to Y user.
I tried login with Z and Uninstall the application.
Still, if I install it again it directly takes me to Y user.
I even tried login out and Delete the application. Again if I install, it returns Y user without even asking for sign in.
NOTE : I havent cleared cache or data . If I do that everything works fine.
The issue is just unistalling the app.
What must be the reason ?
From the docs:
When a user signs up or signs in, that user becomes the current user of the Auth instance. The Firebase Auth instance persists the user's state, so that refreshing the page (in a browser) or restarting the application doesn't lose the user's information.
When the user signs out, the Auth instance stops keeping a reference to the User object and no longer persists its state; there is no current user. However, the user instance continues to be completely functional: if you keep a reference to it, you can still access and update the user's data.
So to solve this, the best way is to create a button and sign out the user. That way that user won't be logged in when you restart the application.
FirebaseAuth.getInstance().signOut();
More info here: https://firebase.google.com/docs/auth/users
Also this question related to ios (but same idea): Firebase - Deleting and reinstalling app does not un-authenticate a user
Some other alternatives also:
adding android:allowBackup="false" in your <application> in manifest.
android:allowBackup
Whether to allow the application to participate in the backup and restore infrastructure. If this attribute is set to false, no backup or restore of the application will ever be performed, even by a full-system backup that would otherwise cause all application data to be saved via adb. The default value of this attribute is true.
Do this as a Test:
Delete Cache and Data
Login with User Y and Logout
Login with User X and Logout
Uninstall the application
Install the application login with user X.
It is important to have FirebaseAuth.getInstance().signOut(); when logging out.

Video playback asks about security timer reset

I am developing a BlackBerry app which can play video. The first time the video starts playing (works fine) it asks with a dialog,
"The application xyz is attempting to reset the security timer. "
Checkbox:
Do not ask again
And the option
Allow / Deny
If allow is choosen and the checkbox selected, the video plays without problem the next time. But is it a way to remove this security timer question before the video is even played?
This is a related or same issue over at the RIM support site.
The dialog you are seeing is the OS prompting the user to grant your application permission to a restricted API call. Even though you are not directly resetting the security timer in your code, it is being done on your behalf as part of your app. The best way to handle this is to prompt the user for permission the first time the user runs your app.
Below is a sample method that prompts the user for all permissions. You should call this the first time your application runs. You could be more selected in what you prompt for by calling permRequest.addPermission( int permission ) for only the permissions that you need. For example pass ApplicationPermissions.PERMISSION_IDLE_TIMER.
private static void assertHasPermissions()
{
// Capture the current state of permissions and check against the
// requirements.
ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
ApplicationPermissions original = apm.getApplicationPermissions();
ApplicationPermissions permRequest = new ApplicationPermissions();
int[] permissions = original.getPermissionKeys();
for ( int i = 0; i < permissions.length; i++ )
{
permRequest.addPermission( i );
}
apm.invokePermissionsRequest( permRequest );
}
http://supportforums.blackberry.com/t5/Java-Development/Enable-the-backlight-and-prevent-the-BlackBerry-device-screen/ta-p/444706
This is just a guess...
It may be that when you start playing the video, the OS assumes a request to reset the security timer so that the device will not lock while the video is playing. It may be easier to be sure if you let us know what version of the device software you are running, and what version of the API you are programming with.

Categories