Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 12    Views: 253

Worker73
Android Fan
Profile
Posts: 419
Reg: Feb 06, 2012
Austria, Klagen...
4,490
07/27/15 06:43 AM (8 years ago)

Parse and Android Studio HOW TO! WORKS!

At first, thanks to MR. CMCOFFEE for the Help... ;-) This HowTo is for the Buzztouch Panel and NOT for Self Hosted... Maybe it Works, but i dont tryed out... 1) Build your App, register an Account on Parse.com, download the SDK end decrompres it. Setup your App on Parse to get the APPID and the SECRETKEY for your App 2) Import your App in to „Android Studio“... 3) Paste the two Files „Parse-X.X.X.jar“ and „bolts-android-X.X.X.jar“ in yout LIBS Folder. Add it to your Library... (Right Click) 4) Paste the Code (https://www.parse.com/apps/quickstart#parse_push/android/native/existing): public void onCreate() {   Parse.initialize(this,"APPID","SECRETKEY");   ParseInstallation.getCurrentInstallation().saveInBackground(); In the „YOURAPP_appDelegate.java“ arround Line: 107.... Looks like this: //when the application is created... public void onCreate() { super.onCreate(); ///////PARSE   Parse.initialize(this,"APPID","SECRETKEY");   ParseInstallation.getCurrentInstallation().saveInBackground(); ///////PARSE BT_debugger.showIt("novumaudio_appDelegate: onCreate"); //get GCM Project Number from manifest... 5) Delete or uncomment in the File: „BT_gcmIntentService.java“ the Lines: 94, 96, 100 to 108 looks like this: // Put the message into a notification and post it. private void sendNotification(String msg){ // BT_debugger.showIt("BT_gcmIntentService:sendNotification: " + msg); // mNotificationManager = (NotificationManager)this.getSystemService(Context.NOTIFICATION_SERVICE); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, BT_activity_host.class), 0); // NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) // .setSmallIcon(R.mipmap.ic_launcher) // .setContentTitle("Notification") // .setStyle(new NotificationCompat.BigTextStyle() // .bigText(msg)) // .setContentText(msg); // mBuilder.setContentIntent(contentIntent); // mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); } } 6) Modify your AndroidManifest.xml File with the Code from Parse: https://www.parse.com/apps/quickstart#parse_push/android/native/existing 7) Thats All.... Fire Up your App and Test it... Maybe any other has a better Idea instead outcommenting the Lines in the „BT_gemIntentService.java“?!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
07/27/15 07:54 AM (8 years ago)
Thank you for the notes! I hope to use this in the near future! Cheers! -- Smug
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
07/27/15 09:04 AM (8 years ago)
I have java 6 installed on my Mac and AS doesn't work, but Eclipse does. Do I need to install Java 7 or maybe Java 8, AS to work? If I do, what will happen with my Eclipse? Will it work in that case?
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
07/27/15 03:40 PM (8 years ago)
You can just comment out the one line in that file that calls sendNotification. It should look something like this sendNotification(someStringVariable);
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
07/28/15 03:05 AM (8 years ago)
I tried self-hosted AS Windows: "5) Delete or uncomment in the File: „BT_gcmIntentService.java“ . ----------- None of these lines are in my BT_gcmIntentService.java. Errors are: Error:(101, 3) error: cannot find symbol variable Parse Error:(102, 3) error: cannot find symbol variable ParseInstallation Error:Execution failed for task ':app:compileReleaseJava'. > Compilation failed; see the compiler error output for details. Looks we have to wait for self-hosted AS?
 
Worker73
Android Fan
Profile
Posts: 419
Reg: Feb 06, 2012
Austria, Klagen...
4,490
like
07/28/15 04:37 AM (8 years ago)
I hope that the Self Hosted Version is comming soon ;-)
 
Worker73
Android Fan
Profile
Posts: 419
Reg: Feb 06, 2012
Austria, Klagen...
4,490
like
07/28/15 04:55 AM (8 years ago)
@CMCOFFE.. When i outcommend line 94 the App Recived 2 Messages... Same Error as before.... When i outcommend line 93... the build Fails because the Staments after that get an Error ;-( Maybe these are the wrong Lines? private void sendNotification(String msg){ BT_debugger.showIt("BT_gcmIntentService:sendNotification: " + msg);
 
miku
Aspiring developer
Profile
Posts: 405
Reg: Feb 20, 2014
zagorje ob savi
10,600
like
07/28/15 04:55 AM (8 years ago)
After trying Parse on BT server too, AS still returns errors: Error:(101, 3) error: cannot find symbol variable Parse Error:(102, 3) error: cannot find symbol variable ParseInstallation Error:Execution failed for task ':app:compileReleaseJava'. > Compilation failed; see the compiler error output for details. What could be wrong? I followed upper manual.
 
Worker73
Android Fan
Profile
Posts: 419
Reg: Feb 06, 2012
Austria, Klagen...
4,490
like
07/28/15 06:38 AM (8 years ago)
Did you Added the two "LIB-Files" from the PARSE SDK and did you added it to the Library?
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
07/28/15 09:56 AM (8 years ago)
Yea you commented out the wrong lines.that's the actual method header you commented out instead of the call to it. Do a search for "sendNotification" .it shouldn't have "private void" in front of it.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
07/28/15 11:27 PM (8 years ago)
finally remembered to take a look in the file. theres actually three calls to send notification, depending on which one is a true statement hope that helps sendNotification("Send error: " + extras.toString()); }else if(GoogleCloudMessaging.MESSAGE_TYPE_DELETED.equals(messageType)){ BT_debugger.showIt("BT_gcmIntentService:onHandleIntent MESSAGE_TYPE_DELETED"); sendNotification("Deleted messages on server: " + extras.toString()); }else if(GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(messageType)){ BT_debugger.showIt("BT_gcmIntentService:onHandleIntent MESSAGE_TYPE_MESSAGE"); //notification of received message. sendNotification("Received: " + extras.toString()); Log.i("zz", "Received: " + extras.toString());
 
Worker73
Android Fan
Profile
Posts: 419
Reg: Feb 06, 2012
Austria, Klagen...
4,490
like
07/29/15 12:06 AM (8 years ago)
@CMCOFFE Doesnt matter.... My Solution (From the First Post) works for me ;-) Thanks for Help....
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
07/29/15 06:53 AM (8 years ago)
Cool just commenting out this line would of probably worked too. mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.