Thursday, March 17, 2016

How To Register For PushBots Services


.
101 How To Register For PushBots Services
Application ID: 56e74ca237d9b074628b4567
Application Secret: 7e8daed7aac0fcaab8d219a363f73b3c
Project ID: moja107-1251
Project number: 926083370846 → Sender Id
Sender Id: 926083370846
API Key: AIzaSyDV8vlwzN2y8phIuTGRYBf9kYQNWRpzKew → Server Key
Server Key: AIzaSyDV8vlwzN2y8phIuTGRYBf9kYQNWRpzKew
Get back to Pushbot Project Dashboard and paste the API Key.
Select API Level (e.g 15)
Select Blank Activity.
Add dependencies statement in build.gradle (module:app)
compile 'com.pushbots:pushbots-lib:2.0.13@aar'
compile 'com.android.support:support-v4:23.1.1'
Update Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.notarazi.moja107pushbottest">
   <!-- GCM connects to Google Services. -->
   <uses-permission android:name="android.permission.INTERNET" />
   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
   <!-- GCM requires a Google account. -->
   <uses-permission android:name="android.permission.GET_ACCOUNTS" />
   <uses-permission android:name="android.permission.WAKE_LOCK" />
   <permission android:name="com.notarazi.moja107pushbottest.permission.C2D_MESSAGE"android:protectionLevel="signature" />
   <uses-permissionandroid:name="com.notarazi.moja107pushbottest.permission.C2D_MESSAGE" />
   <!-- This app has permission to register and receive dataf message. -->
   <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
   <application
       android:allowBackup="true"
       android:icon="@mipmap/ic_launcher"
       android:label="@string/app_name"
       android:supportsRtl="true"
       android:theme="@style/AppTheme">
       <activity
           android:name=".MainActivity"
           android:label="@string/app_name"
           android:theme="@style/AppTheme.NoActionBar">
           <intent-filter>
               <action android:name="com.notarazi.moja107pushbottest.MESSAGE" />
               <category android:name="android.intent.category.DEFAULT" />
           </intent-filter>
           <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
       </activity>
       <receiver
           android:name="com.pushbots.google.gcm.GCMBroadcastReceiver"
           android:permission="com.google.android.c2dm.permission.SEND" >
           <intent-filter>
               <!-- Receives the actual messages. -->
               <action android:name="com.google.android.c2dm.intent.RECEIVE" />
               <!-- Receives the registration id. -->
               <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
               <category android:name="com.notarazi.moja107pushbottest/>
           </intent-filter>
       </receiver>
       <receiver android:name="com.pushbots.push.DefaultPushHandler" />
       <service android:name="com.pushbots.push.GCMIntentService" />
   </application>
</manifest>
res/values/pushbots.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
   <!-- Pushbots Application ID  -->
   <string name="pb_appid">56e74ca237d9b074628b4567</string>
   <!-- GCM Sender ID -->
   <string name="pb_senderid">926083370846</string>
   <!-- Pushbots Log Level  log Tag "PB2" -->
   <string name="pb_logLevel">DEBUG</string>
</resources>
MainActivity.java
package com.notarazi.moja107pushbottest;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import com.pushbots.push.Pushbots;
public class MainActivity extends AppCompatActivity {
   @Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       Pushbots.sharedInstance().init(this);
       //Pushbots.sharedInstance().setNotificationEnabled(true);
       setContentView(R.layout.activity_main);
       Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
       setSupportActionBar(toolbar);
       FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
       fab.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                       .setAction("Action"null).show();
           }
       });
   }
   @Override
   public boolean onCreateOptionsMenu(Menu menu) {
       // Inflate the menu; this adds items to the action bar if it is present.
       getMenuInflater().inflate(R.menu.menu_main, menu);
       return true;
   }
   @Override
   public boolean onOptionsItemSelected(MenuItem item) {
       // Handle action bar item clicks here. The action bar will
       // automatically handle clicks on the Home/Up button, so long
       // as you specify a parent activity in AndroidManifest.xml.
       int id = item.getItemId();
       //noinspection SimplifiableIfStatement
       if (id == R.id.action_settings) {
           return true;
       }
       return super.onOptionsItemSelected(item);
   }
}
...



DOWNLOAD


101PushbotTest.zip

.


12 comments:

  1. how enable push bots, in signed apk?

    ReplyDelete
  2. myTectra Placement Portal is a Web based portal brings Potentials Employers and myTectra Candidates on a common platform for placement assistance

    ReplyDelete
  3. Greetings. I know this is somewhat off-topic, but I was wondering if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform like yours, and I’m having difficulty finding one? Thanks a lot.

    AWS Training in Bangalore | Amazon Web Services Training in Bangalore

    Amazon Web Services Training in Pune | Best AWS Training in Pune

    AWS Online Training | Online AWS Certification Course - Gangboard

    ReplyDelete
  4. You’ve written a really great article here. Your writing style makes this material easy to understand.. I agree with some of the many points you have made. Thank you for this is real thought-provoking content
    Python training in marathahalli
    Python training institute in pune

    ReplyDelete
  5. You’ve written a really great article here. Your writing style makes this material easy to understand.. I agree with some of the many points you have made. Thank you for this is real thought-provoking content
    Python training in marathahalli
    Python training institute in pune

    ReplyDelete
  6. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    Devops training in sholinganallur
    Devops training in velachery
    Devops training in annanagar
    Devops training in tambaram

    ReplyDelete
  7. Very Helpful Post And Explained Very Clearly About All the things.Very Helpful to me.Thank you.
    aws online training | aws training in hyderabad | aws online training in hyderabad

    ReplyDelete