Skip to content

Commit

Permalink
Started implementing shelf code fetching from SMS messages
Browse files Browse the repository at this point in the history
Signed-off-by: developerfromjokela <developerfromjokela@gmail.com>
  • Loading branch information
developerfromjokela committed Jul 25, 2020
1 parent 39df67b commit ba9fb06
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ private String getRequest(String url) throws IOException {
public ParcelObject execute(String parcelCode) {
ParcelObject parcelObject = new ParcelObject(parcelCode);

// TODO when package arrives to finland i.e., it gets tracking from posti. What if we can detect that and load posti details with cainiao's?
try {
String url = "https://global.cainiao.com/detail.htm?mailNoList=" + parcelCode;

Expand Down
31 changes: 31 additions & 0 deletions app/src/main/java/com/nitramite/lokerokoodi_catcher/SMSReader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2020
* Paketin Seuranta
*
* @author developerfromjokela
* @author norkator
*/

package com.nitramite.lokerokoodi_catcher;

import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;

public class SMSReader {

private Context context;

public SMSReader(Context context) {
this.context = context;
}

public void readSMSConversations() {
// TODO check for permissions
ContentResolver contentResolver = context.getContentResolver();
final String[] projection = new String[]{"*"};
Uri uri = Uri.parse("content://mms-sms/conversations/");
Cursor query = contentResolver.query(uri, projection, null, null, null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,9 @@ private static void showNotification(Context context, final String changedParcel
NotificationCompat.Builder notification = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID);
notification.setSmallIcon(R.drawable.notifsmall);
notification.setContentTitle(context.getString(R.string.app_name));
notification.setContentText(context.getString(R.string.notification_message, changedParcelCodeItem, currentEventText));
String content = context.getString(R.string.notification_message, changedParcelCodeItem, currentEventText);
notification.setContentText(content);
notification.setStyle(new NotificationCompat.BigTextStyle().bigText(content).setSummaryText(content));
notification.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.logo));
notification.setContentIntent(pendingIntent);
notification.setAutoCancel(true);
Expand Down

0 comments on commit ba9fb06

Please sign in to comment.