Using Nativescript 5.0.
Below piece of code works well in Android ver 6.0.1
But fails to get permission in Android 8.0
Permission seeking message box does not appear.
Difference observed in both phone's permission details is, in Android 8.0, additional permission is seen as "Dial through contacts" which can not be set manually.
Permissions.requestPermission(android.Manifest.permission.READ_CALL_LOG, "Needed for connectivity status").then(() => {
console.log("refresh - Permission granted!");
this.readCallLog();
alert("in refresh Permission granted");
}).catch(() => {
console.log("Permission is not granted (sadface)");
alert("in refresh Permission NOT granted");
});
Try including READ_PHONE_STATE permission.
But to be precise nothing was changed in Android 8, but Android 9 introduced breaking changes to read call log permission which now requires phone state permission too to work.
While with earlier Android versions you could just request permission READ_CALL_LOG the newer Android versions are introducing some changes in how you could request the user call logs. The idea is to provide more information to the user explaining why you need these permissions.
An explanatory strings values should be provided in the Andorid resources
<string name="permgroupdesc_calllog">read and write phone call log</string>
<string name="permgrouprequest_calllog">Allow <b>%1$s</b> to access your phone call logs?</string>
Also, you will need to ask for a number of permissions and not just READ_CALL_LOG:
CALL_LOG
READ_CALL_LOG
WRITE_CALL_LOG
ROCESS_OUTGOING_CALLS
Details on the above here
used those lines in android:
InstanceID instanceID = InstanceID.getInstance(this);
String token = null;
token = instanceID.getToken(getString(R.string.gcm_defaultSenderId),
GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
got exception , token=null.
google.android.gms.iid.InstanceID.getToken(Unknown Source)
any suggestions?
checked that sender id is ok and api key. no clue.
thanks
I had this error as well. That was because I called instanceID.getToken in the main thread. The GCD guide says that: Do not call this method in the main thread; instead, use a service that extends IntentService.
Here there is a tutorial where is shown how create an IntentService where you can call instanceID.getToken. I hope this help.
thankx for the answer.
I did all the steps except the steps
sendRegistrationToServer(token);
....
since my token was null I was not able to procseed.
I had no problems with parse push service.
when I tried to replace it with gcm it did not work.
The issue is most definitely concerning your google-services.json file. Make sure that you have configured it correctly.
One of the reasons for this "unknown source" issue is a tampered file.
I don't know what I'm doing when it comes to OAuth and twitter APIs so I've followed this tutorial and I'm able to get this working on a Linux server. However I cannot on a Windows server. It throws the coded error message.
Oops, something went wrong with our twitter feed...
if (!$tweet_flag) {
echo $tweets = '<ul class="twitter_stream twitter_error"><li>Oops, something went wrong with our twitter feed - Follow us on Twitter!</li></ul>';
}
Is there something that would cause there to be an issue?
Found another solution:
http://f6design.com/journal/2013/06/20/tweetphp-display-tweets-on-your-website-using-php/
This worked fine on the site.
I encountered a facebook login problem. I installed FB SDK 3.0 and sample projects seemly run well --- not quite sure though. When I create a button in my own project and try to log in to Facebook, I always get FBSessionStateClosedLoginFailed from sessionStateChanged method, although I apparently get the page "You have already authorized this app. Press Okay to continue". I also tried log out through Simulator Safari facebook page, and re-launched my project and I got new username/password page and I then logged in, but I still get FBSessionStateClosedLoginFailed!
A few more observations.
1, I got FBSessionStateClosedLoginFailed thru NSLog, the log comes up right after I clicked Okay button on the Facebook page "You have already authorized this app.
2, I tried clean xcode project cache, but no help.
Kind of frustrated. I wonder if any of you can help on this problem. Appreciated!
-Tony
Addition:
I did a bit more research, and I found what I have is probably a typical problem, as Facebook highlight here ("Pro-tip 3: Complete all iOS App Settings" section in page http://developers.facebook.com/docs/howtos/login-with-facebook-using-ios-sdk/). The image with a big red cross over iPhone is exactly what I have. From xcode project, I click my login button, and I'm directed to this page, and every time I have to click "Okay" on this page (let me call it Okay_page) to go back to my app in Simulator, however with login status as FBSessionStateClosedLoginFailed. I checked bundle ID, I have it correct. I don't have a 'YOUR_IPHONE_APP_STORE_ID' yet, which I believe I need pay Apple to get and I will do it later but not while I'm still working on it.
Now get a couple of questions:
1, Do I have to have YOUR_IPHONE_APP_STORE_ID to skip this Okay_page?
2, Does this (not automatically re-directed back to my app from this Okay_page) have anything to do with that I always get a login status of FBSessionStateClosedLoginFailed when I manually click Okay in this Okay_page and return to my app in Simulator? In another word, is (that I have to manually click Okay to get back to my app in Simulator) (the reason I got a status of FBSessionStateClosedLoginFailed)?
Did you have set this function in AppDelegate?
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [FBSession.activeSession handleOpenURL:url];
}
I had the same issue:
We created the facebook app (developer.facebook.com) setting our
bundle id (ex. com.MyCompany.MyApp)
Off course, created our iOS app with the same bundle id
After delivered our app to the client, he changed the bundle id
without notify us.
Obviously he started to get FBSessionStateClosedLoginFailed errors!
So, you probably have different bundle id's between your iOS project and your Facebook App.
I had this error and couldn't resolve it for quite some time. It turns out that if you are using the native iOS Facebook account in settings and choose "no" for allow Facebook for this app, the app is blocked by the OS. You will always get the FBSessionStateClosedLoginFailed error and there is nothing you can do inside the code to fix this (99% sure). The best you can do is alert the user to check out the settings.
i am typing wrong line in given below method. self.session was nil
return [self.session handleOpenURL:url];
it should be
return [[FBSession activeSession] handleOpenURL:url];
Use Following Method.
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
// attempt to extract a token from the url
return [[FBSession activeSession] handleOpenURL:url];
// return [self.session handleOpenURL:url];
}
I fixed this problem after I reset the simulator. iOS Simulator - Reset Content and Settings..., hope to help.
I had this issue because I was calling [FBSession.activeSession close] in my applicationDidEnterBackground: app delegate callback. This closed the session so that when the redirect brought the app back up to open the session, it failed because it had been put into the closed state.
Make sure that you're not closing the session anywhere before you get to the Okay page.
go to Facebook.com. Open your application on the left panel -> Status & Review -> there is a toggle with text "Do you want to make this app and all its live features available to the general public?". Turn it on
well. I followed FBLoginCustomUISample somewhere on github.com and it was a working example of facebook login implementation from facebook itself. You can also read my workaround while creating facebook login feature in a iOS app. Here is a link form me:
Native iOS Facebook SSO won't return to app
I'm trying to use the Facebook C# SDK from Codeplex on my WP7 app. I managed to build & run the application by manually adding Facebook.dll and Microsoft.Contracts.dll. But I only see a blank login(?) page :
The code enters FacebookLoginBrowser_Navigated, after loading this url :
http://www.facebook.com/dialog/oauth/?response_type=token&display=touch&scope=user_about_me,read_notifications&client_id=119779898114420&redirect_uri=http://www.facebook.com/connect/login_success.html
but the URL seems to have been redirected to this one :
http://m.facebook.com/login.php?app_id=119779898114420&cancel=http://www.facebook.com/connect/login_success.html?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request.&fbconnect=1&next=http://www.facebook.com/connect/uiserver.php?method=permissions.request&app_id=119779898114420&display=touch&redirect_uri=http%253A%252F%252Fwww.facebook.com%252Fconnect%252Flogin_success.html&response_type=token&fbconnect=1&perms=user_about_me%252Cread_notifications&from_login=1&rcount=1
The important part is "User denied access", which I didn't, since I don't see anything except a blank page.
Thanks in advance !
edit: pasting the first url into an iPhone simulator Safari.app, I see the Facebook login screen, then after login, I see the grant permission screen...
your browser is not script enabled, try to set the flag at true :