Titanium: Android device token without Cloudpush - android

Is there anyway to get device tokens without using Cloudpush modules. All I'm interested in is getting tokens and store onto my server and then I can push notification to registered devices.
I have tried to use it Cloudpush module from this link
http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.CloudPush
I followed these steps:
1) First Step :
Open this link https://developers.google.com/console/
than login with you account. Create a new project
i) "Creating a Google API Project",
ii)"Enabling the GCM Service"
iii)"Obtaining an API Key"
Image snap link : http://1.bp.blogspot.com/-AKAcUDtW0gg/UlK8rcpqUQI/AAAAAAAACuI/aq89OFZc2C4/s1600/all_steps.png
2) Second Step :
Click on this link https://cloud.google.com/console#/project
You can found you project that you already created.
Just Click on that and you found the Example: Project Number: 91060sdsdgsd
3) Third Step :
Now next step open this url https://my.appcelerator.com/apps
Login with your appcelerator account where you want to configure this vcm.
Click on your project than at the top side there are two option (Production/Development).
Click on Development. Now the main menu box will open in that there is 2nd (Second) tab click on that.
Now you found in that page Android Push Configuration
please fill this both fields
i) Google Cloud Messaging(GCM) API Key:
ii)Google Cloud Messaging (GCM) sender ID:
However all I'm getting is Failed receiving GCM SenderId.

As you already know the process to get keys/etc, so I wont rewrite it.
You asked to fetch the device token without Cloudpush , yes it can be done and you have to use a GCM module for this process.
Following info will be helpful in using module :
You can view the module's info at GCM Titanium.
The zip file of module is at in dist folder ( use latest version of zip ).
Example to use module is under example folder.
Hope it helps.

Related

Firebase console - problem receiving test push FCM notification in android device

I am sending push notification using firebase console and i am getting "0% of potential users are eligible for this campaign: 0". and push notification is not displaying in mobile..If anyone got same experience and solve issue then please suggest me how can i solve this issue. I followed all the thing..that i added json file that i got from firebase.
Please check for the following:
Have you configured your android package name correctly.
Did you place the google-services.json file in android/src folder.
Make sure you have done all steps present in this link (If you using android studio i suggest going with option 2)
Get user token to send firebase message Follow the steps
After all these if you still can't receive push notifications try setting channelid in advanced messaging options
Refer https://firebase.google.com/docs/cloud-messaging/android/client link step by step and you will be good to go for your push notification using fcm and if you already implemented the basic things then compare your code with the sample code step by step mentions on the link. you must find out the error. let me know if it resolves your issue.
Go to Build --> clean project -->Rebuild project
(Build is at top in android studio)
Why it was not working - You must have had deleted google-services.json file and re-added it.
Make sure you have only one firebase project configured for this app (if no then delete one you dont plan to use)
Go to firebase setiings -> Left top angle -> settings icon -> Project settings ->
scroll to bottom, then make sure to add SHA certificate fingerprints Type. How to get it
Then (still on this page) press See SDK instructions button. And place google-services.json file in your project.
If all this steps passed for you and you still getting this error then just wait a little bit, for me it take 2 days, before it started working.

branch.io deep-linked URL not passing data in App from Facebook Ads

We are using branch.io to pass custom data to App. For that we are following this steps in branch dashboard.
1) Ads -> Partner Management -> Facebook -> Create Facebook Link
2) Set data in Key/Value under "Deep Linking" Section (data which we need in our app)
3) We set Play/App Store URL in Android/iOs respectively Or set Default Redirects under "Redirects" section
That's it!!!
Now Go to Facebook Ads Manager and select App Install Campaign.
1) Select Play/App Store under App Section.
2) Set above generated URL under "deffered deep link"
You can read more here : https://docs.branch.io/pages/deep-linked-ads/facebook-app-install-ads/
Now Our Problem is :
When user clicked on any branch link with deep link params it able to receive data in both case when user fresh install the application and if user has already app installed.
When we clicked on Facebook ads with same url we are unable to get branch data if user has not installed application (Mostly in case when user redirect from App Store/play store) . But user has installed the app we can able to receive all branch data from same url.
So Question is:
1) Do we need any permission from Facebook or missing any configuration on Branch or Facebook?
2) The same thing will work with both (e.g. Android and iOs) devices?
Thanks
Unfortunately the branch.io documentation for setting this is up is pretty incomplete - we just spent about a week testing and debugging the SDK to figure out how to get it to work. The necessary changes itself are actually quite simple.
On Android:
Integrate the Facebook SDK if you haven't done so already
Ensure that the facebook_app_id string resource you added as part of (1) is not prefixed with "fb"
If you are using ProGuard, add rules to keep the relevant parts of the Facebook SDK
Call enableFacebookAppLinkCheck() on your Branch instance right after initializing it
On iOS:
Integrate the Facebook SDK if you haven't done so already
Call registerFacebookDeepLinkingClass(FBSDKAppLinkUtility.self) on your Branch instance right after initializing it
I had this exact same problem, but in a React Native project, so I'm using react-native-branch. #henning-dodenhof 's answer helped me a lot (thanks for figuring this out!), but I needed a couple of further adaptations, so I add this answer in case it's useful for someone else since this post was the main thing I found regarding this issue:
For iOS:
The FB SDK registration needs to happen before initializing Branch, not after as the above answer suggests. So, before this line that you add as part of the normal library setup:
[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES];
You need get the Branch instance from RNBranch and then register this FB SDK class:
[[RNBranch branch] registerFacebookDeepLinkingClass:[FBSDKAppLinkUtility class]];
Adding this new line before the initialization is critical, doesn't work if it's done after.
For Android:
Here the setup code already gets an instance with Branch.getAutoInstance(this), so we can just chain the registration:
Branch.getAutoInstance(this).enableFacebookAppLinkCheck();
It looks like the getAutoInstance above doesn't actually fully initializes the instance, so you can call enableFacebookAppLinkCheck right after, and the instance gets fully initialized after the first use.

Can't receive a push notification from pushwoosh.com

1. I download: Sample Project from this link
2. Import in my eclipce this project
pushwoosh-sdk-samples-master.zip\pushwoosh-sdk-samples-master\Native\Android\
3.
On website is info that
PW_APPID – Pushwoosh Application ID
(MY: Application Code: 8CD4F-FXXXX)
PW_PROJECT_ID – Project Number you receive from Google GCM
(MY: Project ID: eternal-psyche-777 Project Number: 520518000000)
So i replace this info in manifest to mine
meta-data
android:name="PW_APPID"
android:value="8CD4F-FXXXX"
meta-data
android:name="PW_PROJECT_ID"
android:value="520518000000"
4. Also I add Google Cloud Messaging API Key to Application on pushwoosh.com
But after sending a push notification, nothing happens...What is wrong?
UPDATED:
Found
where PW_APPID – Pushwoosh Application ID, PW_PROJECT_ID – Project Number you receive from Google GCM, Project ID is a number but make sure you prefix it with the letter “A”
but I still can't receive a push-notification...

GoogleJsonResponseException : 404 not found / 401 Unauthorized in settings google apps endpoint engine backend in android Google Cloud Save

Hello friends i starting learn about google cloud save, so i create apps and follows step given in google.developer and i am also using their example using link https://github.com/GoogleCloudPlatform/solutions-mobile-backend-starter-android-client
and https://developers.google.com/cloud/samples/mbs/android/ but i think i face some problem in autentication, and got error com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found
and some time : com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unautorized
i just want to store my game score using google cloud save.please any one can give me solution about it or any related links ? thanks in advance.
I find my own solution :
I follow following step :
hope these help you if necessary :
Assume you are created project on https://console.developers.google.com/
and follow necessary step
like
In API & AUTH -->APIs
Google cloud Storage and Google cloud Messaging for android and whatever you need On
In API & AUTH -->Credentials
Create new Client ID
for
-->Client ID for Android Application and
-->Client ID for Web Application
-->Key for server applications
(1) Open the Google API Console and make sure your Mobile Backend project is the active project by selecting it in the projects pulldown menu in the top left.
(2) Click Services.
(3) Locate Google Cloud Messaging for Android in the list of available services, and click the ON toggle.
(4) Accept the Terms of Services if you have not already.
(5) Click API Access in the top left of the API console.
(6) Scroll down to click Create new Server key... You don't need to supply any IP values in this form. (Using a server key allows you to whitelist IP addresses).
(7) Click Create.
(8) Locate the API key within the Key for server apps form and copy this key to the clipboard.
(9) Navigate to .appspot.com. This will bring you to your Mobile Backend Starter settings configuration page.
(If not find then find from : click on your created project from the https://console.developers.google.com/ click on your created project Monitoring-->overview-->find Mobile Backend Starter from the bottom- of the screen click on that )
(10) Follow all three step of Deployment steps:
-->Deploy the backend
-->Open (for development use only) the backend to accept incoming requests via Settings
click on Settings-->Mobile Backend settings-->
---> Radio button on of **Secured by Client IDs (Recommended)**
---> Enter **Android Client Id, and Web Client id**
---> Google Cloud Messaging and iOS Push Notification **Enabled**
--->**Save**
-->download Sample Project if necessary
In sample project open Const.java file
Enter project_id,
Project_number,
Web_client_id(enter client_id_for_web_application here )
public static final boolean IS_AUTH_ENABLED = **true**;
public static final boolean LOCAL_ANDROID_RUN = **true**;
public static final String ENDPOINT_ROOT_URL = "https://" + PROJECT_ID
+ ".appspot.com/_ah/api/";
If Necessary go to :
App Engine Console -> Main -> Versions. ( https://appengine.google.com/ )
select your project
There you will see a list of versions with a Make Default button below. Select the radio button for the latest version and press the make default button, wait a minute or so, and try your call again.
Note that even if you have only one version that is already set as the default this solution should still work.
You may have to do this again the next time you deploy to app engine.
Hope my above step helping to anyone.
Faced this error when I had not deployed the latest version of backend to the google app engine. HTH

Android GCM SENDER_ID, how to get it?

I try to migrate to GCM and I have an issue with the SENDER_ID I need to provide. I use the demo project from google. In this project I need, if I understand this well, to provide a SENDER_ID to the application in the CommonUtilities.java file.
The SENDER_ID I provided is the API key I registered on https://code.google.com/apis/console/ and has this form: AIzaSyAxxxxxxx_xxxxxxxxxxxnoGZw (total 40 chars).
Using this string as SENDER_ID I get on "BroadcastReceiver mHandleMessageReceiver" an error message: From GCM: error (INVALID_SENDER)..
Where is the mistake? The string I provide is not the SENDER_ID?
Thank you.
No, the SENDER_ID is the project ID you signed up at Google API console, it should a numeric string. e.g. on your browser URI, you should see this:
https://code.google.com/apis/console/#project:4815162342
The Sender ID is 4815162342
Updated Answer:
Google has not updated its docs completely. The above answer is old and its based on this documentation and it seems that its still not updated.
According to updated Google docs, it seems that Project Number on Google API Console is used as SENDER ID
I have done for Latest Google API Console.
How to get SenderId:
Steps:
Open Google api console
Create project
Click on Left hand side menu icon
Click on Google cloud Platform
You would get SenderId form there
Reference:
Hope this will help you.
Go to your Google APIs Console page. Select the project you use from the drop down menu on the left. Select Overview and now you can see you project number. It is the SENDER_ID you have to use
Another way to get your project number is to get the value of "project" from your url. Your url has to be like this: "https://code.google.com/apis/console/b/0/#project:886025556782". Here the project number is "886025556782". this number is SENDER_ID
An updated answer as of Nov 2014 IF YOU'VE CREATED AN API PROJECT RECENTLY.
First of all, correct, you should absolutely go to the Google Developers Console and find the Project that you have GCM enabled on. When looking at the Overview section (left-hand nav panel), you'll see Project ID and Project Number listed on the right hand side. Project ID was failing for me (which is what led me here), but when I tried the Project Number, I'm able to register my clients correctly now.
Note that this is different because Google modified how they assign project IDs recently. In October I made a project and was given an all numerical Project ID, which I assume would work fine. But the one I created today was given a two-word and a number id (like Hamster-Party-420) and a numeric Project Number. The URL to my project contains Hamster-Party-420, and the Project Number is only visible on the Overview screen.
Yet another updated answer with little more explanation for the confused(..like I was).(with due credit to #azgolfer, #PankajAndroid and #Adam)
1- If you create a project at https://console.developers.google.com, you can see two things "PROJECT ID" and "PROJECT NUMBER" in project overview. Project Id is no longer numeric but alpha numeric like master-xxxxx-1234. Project number is a 11 digit number like 123456789100.
2- Even when you inspect the browser link you can find it as:
https://console.developers.google.com/project/master-xxxxx-1234
So is master-xxxxx-1234 is the SENDER_ID (at some places referred as PROJECT ID)? NO.
You have to use the project number as project id in GCM.
3- Where can you cross check that project id is being used as project id?
On API Dashbaord. (url: https://code.google.com/apis/console/b/0/?noredirect#project:12345678900 - where 12345678900 is your project number on project dashboard.
SUMMARY: Project Id in Project Dashboard and API Dashboard are different. The project number in project dashbaord is used as project id in API Dashboard and Project Id in project dashbaord as Project name in API Dashboard. So the project number shown in the Project Dashboard when we create project in developer console is used as SENDER_ID in GCM.
Go to "Dashboard" in the latest version of the developers console, click the drop down arrow under "Project: Turtle Power" and you can see the Project number right there! Use that as your SENDER_ID
(fake project so don't even try it =P)
Maybe you haven't activated Google Cloud Messaging for Android in API COnsole.
Here is the instructions:
http://developer.android.com/google/gcm/gs.html
We spent hours trying to figure this out. The problem was that our android manifest did not include the sender id!
If you came here because you are doing web push, Android push, or the like, there is a different answer.
Source: https://firebase.google.com/docs/cloud-messaging/js/client
the SENDER_ID you are using is nothing but the authorization key.
you can find the SENDER_ID at your projects Google APIs Console pages URL
https://code.google.com/apis/console/#project:8543162367
here 8543162367 will be your SENDER_ID ,
and also the Project Id is no longer numeric its alpha-numeric or only numeric or only alphabetic anything but its position is same as shown by me

Categories

Resources