[android-developers] Bad notification posted - Couldn't expand RemoteViews for: StatusBarNotification

2016-08-08 Thread Darshan Phy

Hey everyone,

The requirement was to make a custom notification since the android's 
default notification only allows for an image. So I went through on how to 
attach a custom UI for notification when expanded, the ready answer was to 
create a custom view and pass to the notification manager and allowed from 
API level 16.
So I did one and here the my layout xml code - filename: 
notification_custom_view_new:

http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@color/GhostWhite";>


























The way I referenced it in code:

private RemoteViews assignRemote(Bitmap bitmap, String title, String message
){
  RemoteViews expandedView = new RemoteViews(Application.getInstance().
getPackageName(), R.layout.notification_custom_view_new);
  expandedView.setTextViewText(R.id.title, title);
  expandedView.setTextViewText(R.id.message, message); expandedView.
setImageViewBitmap(R.id.big_picture, bitmap);
  expandedView.setImageViewResource(R.id.big_icon, R.mipmap.ic_launcher);
  expandedView.setTextViewText(R.id.time, getOnlyHrsMin());
  return expandedView;
}


assigning customview to notification manager:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
notification.bigContentView = assignRemote(bitmap, title, message);
}

But this gave me error saying bad notification, I have identified over 15+ 
same question here on stackoverflow without a right answer.. Some suggest 
it to be a resource missing and hence the error. I am sure from my end none 
of the values are null nor resources missing errors are not there in my 
remote view that is passed.

Any help will be appreciated and also I have tried for around a couple of 
days to track the error but nothing good seems to happen. Please help me!

Screenshot attached for layout UI.. also find the NotificatioUtils and 
layout xml files attached for reference.

Thanks
DJphy



-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/1cc8ccad-f636-4558-9be8-5a83d5598012%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


notification_custom_view_new.xml
Description: XML document
package com.goldadorn.main.dj.support.gcm;

import android.app.ActivityManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.support.v7.app.NotificationCompat;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
import android.util.Patterns;
import android.widget.RemoteViews;

import com.goldadorn.main.R;
import com.goldadorn.main.activities.Application;
import com.goldadorn.main.dj.utils.Constants;
import com.goldadorn.main.dj.utils.DateTimeUtils;
import com.goldadorn.main.dj.utils.IntentKeys;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * Created by COMP on 2/25/2016.
 */
public class NotificationUtils {

private static String TAG = NotificationUtils.class.getSimpleName();

private static Context mContext;

public NotificationUtils() {
}

public NotificationUtils(Context mContext) {
this.mContext = mContext;
}

public void showNotificationMessage(String title, String message, String timeStamp, Intent intent) {
showNotificationMessage(title, message, timeStamp, intent, null);
}

public void showNotificationMessage(final String title, final String message, final String timeStamp, Intent intent, String imageUrl) {
// Check for empty push message
if (TextUtils.isEmpty(message))
return;


// notification icon
final int icon = R.mipmap.ic_launcher;

intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra(IntentKeys.PUSH_NOTIFICATION_CALL, Constants.GCM_CALL);
final PendingIntent resultPendingInten

[android-developers] APK size weirdly got increased (increase upto 10 MB)

2016-06-17 Thread Darshan Phy

Hey Hi everyone,

I am currently working on this project for my company.
The initial/usual size of the apk before the weird thing happened was ~10MB
This project uses two external libraries
1. KAndroid (company customised lib, not to worry)
2. PayU - Payment gateway for our app.
Note: I am excluding all the libs from GRADLE dependency (assuming the libs 
thr are not contributing much to the apk size)

But you can check the build.gradle as well I might wrong in assuming.

Issue:
# The entire resources folder is 2.56MB (size on disk) and 1.63MB(size)
# The size of the APK suddenly, drastically and weirdly got increased by 
10MB last week and now the size of the APK is ~20MB.
# No extra libs have been added since 6 months back. The KAndroid lib was 
always there from the beginning, PayU sdk (payment gateway lib) was added 
months back.
# The sdk PayU's build folder is around ~20MB, this could have been a 
suspect but it was added months back as I said and so the APK size must 
have been increased initially only and not in the last week

link to my entire project on drive; please feel free to checkout: 
https://drive.google.com/open?id=0B-lDLHmPjFIwS0U0NVZnVTRPYjQ
I could have linked to the same project at bitbucket but since last few 
days i haven't pushed the code yet... Sorry about the huge size of zip file 
on drive

It will be a great help if someone can find me a solution.
Awaiting your responses
Thanks a ton 

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/b2264f43-e044-4565-aea3-cf4a85139833%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: IMPORTANT - display.getOrientation() does not work on all devices

2009-11-01 Thread Phy
Okay can I just summarise my problem as I believe it is an issue which
NEEDS to be addressed...

I have confirmation from five users who either have a HTC G1 or HTC
Magic who say my application works fine. However, I have had numerous
recent comments on the Market that the orientation of my applications
interface is rotated 90 degrees on G1/Magic devices.

I use this method to get the screen orientation:
getResources().getConfiguration().orientation;

and remap the coordinate system as follows before drawing the
application interface:

if(screenOrientation == 1) {  // Portrait
  SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_MINUS_Z,
SensorManager.AXIS_X, outR);
}
else { // All other send to Landscape
  SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_X,
  SensorManager.AXIS_Z, outR);
}


How can this work fine on some phones and completely break on other
peoples phones which are the same make and model?

This is really disconcerting, and needs to be explained.


On Nov 1, 11:06 pm, mscwd01  wrote:
> Well Niko that may be true but it doesn't change the fact that it
> works fine on an HTC Hero and some G1 & Magic phones.
>
> It should either work or not, having your application work fine on
> some devices and break on other devices is rediculous and its getting
> annoying now.
>
> iPhone here I come :(
>
> On Nov 1, 3:18 am, niko20  wrote:
>
> > Wait-
>
> > YOu are remapping the coords after rotation? Well then that's where
> > the problem has to be, since clearly Mark has shown that the
> > getOrientation() works correctly
>
> > -niko
>
> > On Oct 31, 1:25 pm, mscwd01  wrote:
>
> > > Well then this is extremely confusing!
>
> > > Firstly, thanks Mark for taking the time to test it.
>
> > > The only other thing which could be wrong is how the coordinate system
> > > is represented in each device. I draw to the screen once I have
> > > remapped the coordinate system i.e.:
>
> > > if(screenOrientation == 1) {  // Portrait
> > >   SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_MINUS_Z,
> > > SensorManager.AXIS_X, outR);}
>
> > > else { // All other send to Landscape
> > >   SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_X,
> > > SensorManager.AXIS_Z, outR);
>
> > > }
>
> > > However, this shouldn't be an issue should it?
>
> > > On Oct 31, 6:19 pm, Mark Murphy  wrote:
>
> > > > mscwd01 wrote:
> > > > > Okay this is getting really rather annoying now.
>
> > > > > I have used both of the following methods of getting the screen
> > > > > orientation and both do not work properly on different devices.
>
> > > > > Method 1:
> > > > > Display display = ((WindowManager) getSystemService
> > > > > (WINDOW_SERVICE)).getDefaultDisplay();
> > > > > int screenOrientation = display.getOrientation();
>
> > > > > Method 2:
> > > > > int screenOrientation = getResources().getConfiguration().orientation;
>
> > > > > Both methods work fine on the HTC Hero; however, they both fail on the
> > > > > G1 and G2 devices (according to the users of my app).
>
> > > > > How can we be expected to make high quality applications if the API is
> > > > > not supported on all devices???
>
> > > > > I would be very greatful if someone could offer a solution to this,
> > > > > its just not acceptable.
>
> > > > I just tested this on a G1, and
> > > > getResources().getConfiguration().orientation is 2 in landscape and 1 in
> > > > portrait, just like it should be.
>
> > > > I also tested it on an HTC Magic, and it works just fine.
>
> > > > Heck, it even works on an ARCHOS 5 Android tablet.
>
> > > > --
> > > > Mark Murphy (a Commons 
> > > > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > > > Android Development Wiki:http://wiki.andmob.org

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: SensorManager Query

2009-08-08 Thread Phy

This is a question i'd like to get the answer to as well. The java
docs dont explain whats required very well.

On Aug 7, 6:12 pm, mscwd01  wrote:
> Hi,
>
> I would like to get the orientation of the phone i.e. its compass
> bearing (azimuth), pitch (around X axis) and roll (around Y axis).
>
> I have found the method 'getOrientation(float[] R, float[] values)'
> which seems to serve this purpose, however I am unsure what I need to
> pass to it as a parameter.
>
> Apparently the two parameters are:
> R               rotation matrix see getRotationMatrix(float[], float[],
> float[], float[]).
> values  an array of 3 floats to hold the result.
>
> What is this rotation matrix and how do I create it?
> Also the float array 'values' - is this just an empty array which it
> uses to store the results of the method call, or does it need
> populating with specific values?
>
> Thanks in advance

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---