hi, i tried to setup push notifications in my android app. i follwed the tutorial and set it up. i dont know how much ive done right. ill be adding snippets of by code below. the ussr gets added to the push notification users in the app42 hq push options but when i click on send push from the hq the device doesnt recieve the notifications.
im explaining in short what i have done, i downloaded the push notification example available on github. made the package com.shephertz.app42.push.plugin in my app. copy pasted all the classes from the sample app to mine.
the following code is a part of my homeactivity which is launched after the user loggs in
import com.shephertz.app42.paas.sdk.android.App42API;
import com.shephertz.app42.paas.sdk.android.App42Log;
import com.shephertz.app42.push.plugin.App42GCMController;
import com.shephertz.app42.push.plugin.App42GCMController.App42GCMListener;
import com.shephertz.app42.push.plugin.App42GCMService;
import com.shephertz.app42.paas.sdk.android.App42API;
public class HomeActivity extends AppCompatActivity implements App42GCMListener{
private static final String GoogleProjectNo = "my projct no<editied for privacy>";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
App42API.setLoggedInUser(App42API.getLoggedInUser());
App42Log.setDebug(true);
}
public void onStart() {
super.onStart();
if (App42GCMController.isPlayServiceAvailable(this)) {
App42GCMController.getRegistrationId(HomeActivity.this,
GoogleProjectNo, this);
} else {
Log.i("App42PushNotification",
"No valid Google Play Services APK found.");
}
}
@Override
public void onError(String errorMsg) {
// TODO Auto-generated method stub
}
@Override
public void onGCMRegistrationId(String gcmRegId) {
// TODO Auto-generated method stub
App42GCMController.storeRegistrationId(this, gcmRegId);
if(!App42GCMController.isApp42Registerd(HomeActivity.this))
App42GCMController.registerOnApp42(App42API.getLoggedInUser(), gcmRegId, this);
}
@Override
public void onApp42Response(final String responseMessage) {
// TODO Auto-generated method stub
runOnUiThread(new Runnable() {
@Override
public void run() {
}
});
}
@Override
public void onRegisterApp42(final String responseMessage) {
// TODO Auto-generated method stub
runOnUiThread(new Runnable() {
@Override
public void run() {
App42GCMController.storeApp42Success(HomeActivity.this);
}
});
}
final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String message = intent
.getStringExtra(App42GCMService.ExtraMessage);
}
};
}
please solve this for me asap.
thanks